<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-select v-model="filters.phaseId" placeholder="请选择学段" @change="getGradeList(filters.phaseId)" style="width:150px;" clearable>
						<el-option v-for="(item,i) in phaseList" :key="i" :label="item.phaseName" :value="item.phaseId"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-select v-model="filters.gradeId" placeholder="请选择年级" style="width:150px;" clearable>
						<el-option v-for="(item,i) in gradeList" :key="i" :label="item.gradeName" :value="item.gradeId"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="getClassesList">查询</el-button>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="handleAdd">新增</el-button>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="handleImport">导入</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="tableData" highlight-current-row v-loading="listLoading" style="width: 100%;">
			<el-table-column type="index" label="序号" width="60" align='center'>
				<template slot-scope="scope">   
                    {{pageSize*(nowPage-1)+scope.$index+1}}
                </template>
			</el-table-column>
			<el-table-column prop="classesName" label="班级名称" min-width="190" align='center' >
			</el-table-column>
			<el-table-column prop="phaseName" label="学段" min-width="100" align='center' >
			</el-table-column>
			<el-table-column prop="gradeName" label="年级" min-width="120" align='center' >
			</el-table-column>
			<el-table-column prop="enterYear" label="入学年份" min-width="100" align='center' >
			</el-table-column>
			<el-table-column prop="graduateYear" label="毕业年份" min-width="100" align='center' >
			</el-table-column>
			<el-table-column label="操作" width="320" align='center' fixed="right" >
				<template slot-scope="scope">
					<el-button type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button>
					<el-button type="danger" size="small" @click="handleDel(scope.row)">删除</el-button>
					<el-button type="warning" size="small" @click="handleTeacher(scope.row)">班主任</el-button>
					<el-button v-if="checkMenu('/classesteacher')>=0" type="success" size="small" @click="handleSubjectTeacher(scope.row)">教师</el-button>
				</template>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination background layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="text-align: center; ">
			</el-pagination>
		</el-col>

		<!--编辑界面-->
		<el-dialog :title="editType" :visible.sync="editFormVisible" :close-on-click-modal="false" :before-close="closeDialog" :append-to-body="true" v-loading="editLoading">
			<el-form :model="classesForm" label-width="120px" :rules="classesRules" ref="classesForm">
				<el-form-item label="学段" prop="phaseId">
					<el-select v-model="classesForm.phaseId" placeholder="请选择学段" @change="getEditGradeList(classesForm.phaseId)" style="float:left;width:60%;">
						<el-option v-for="(item,i) in phaseList" :key="i" :label="item.phaseName" :value="item.phaseId"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="年级" prop="gradeId">
					<el-select v-model="classesForm.gradeId" placeholder="请选择年级" @change="changeGrade(classesForm.gradeId)" style="float:left;width:60%;">
						<el-option v-for="(item,i) in editGradeList" :key="i" :label="item.gradeName" :value="item.gradeId"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="班级编号" prop="classesNo">
					<el-input v-model="classesForm.classesNo" placeholder="请输入班级编号" style="float:left;width:60%;"></el-input>
				</el-form-item>
				<el-form-item label="班级名称" prop="classesName">
					<el-input v-model="classesForm.classesName" style="float:left;width:60%;" readonly></el-input>
				</el-form-item>
				<el-form-item label="入学年份" prop="enterYear">
					<el-input v-model="classesForm.enterYear"  @change="changestartYear(classesForm.enterYear)" style="float:left;width:60%;"></el-input>
				</el-form-item>
				<el-form-item label="毕业年份" prop="graduateYear" >
					<el-input v-model="classesForm.graduateYear" @change="changeendYear(classesForm.graduateYear)" style="float:left;width:60%;"></el-input>
				</el-form-item>
				<el-form-item label="个性班名" prop="personalityName">
					<el-input v-model="classesForm.personalityName" style="float:left;width:60%;"></el-input>
				</el-form-item>	
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click.native="closeDialog">取消</el-button>
				<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
			</div>
		</el-dialog>
		<!-- 设置班主任 -->
		<el-dialog :title="classesName+' 班主任：'+ teacherName "  :visible.sync="classTeacherVisible">
				<el-row :gutter='5' style="border-bottom: 1px groove hsla(0,0%,76%,.24);line-height: 55px;font-size: 14px;">
					<el-col :span="25">
							<el-col :span="7">
								<el-select v-model="classesTeacherForm.phaseId" placeholder="选择学段" style="width:100px;" @change="getSubjectList(classesTeacherForm.phaseId)" clearable>
									<el-option v-for="(item,index) in phaseList" :key="index" :label="item.phaseName" :value="item.phaseId"></el-option>
								</el-select>
							</el-col>
							<el-col :span="7">
								<el-select v-model="classesTeacherForm.subjectId" placeholder="选择学科" style="width:100px;" clearable>
									<el-option v-for="(item,index) in subjectList" :key="index" :label="item.subjectName" :value="item.subjectId"></el-option>
								</el-select>
							</el-col>
							<el-col :span="8">
								<el-input style="width:130px;" placeholder="输入查询姓名" v-model="classesTeacherForm.userName" clearable ></el-input>
							</el-col>
							<el-col :span="2">
								<el-button type="primary" @click="findSchoolTeacher">搜索</el-button>
							</el-col>
					</el-col>
				</el-row>
			<el-table :data="classesTeacherData"  style="width:99%" highlight-current-row @current-change="TeacherChange" height="300" v-loading="teacherLoading">
				<el-table-column prop="userName" label="姓名" width="100" align='center' min-width='100' fixed></el-table-column>
				<el-table-column prop="phaseName" label="学段" width="150" align='center' min-width='150'>
				</el-table-column>
				<el-table-column prop="subjectName" label="学科" width="200" align='center' min-width='150'>
					<!--<template slot-scope="scope">
						<span v-for="(item,index) in scope.row.subjects" :key="index">{{item.subjectname}} </span>
					</template>-->
				</el-table-column>
			</el-table>
		</el-dialog>
		<!-- 班级导入 -->
        <el-dialog title="班级批量导入" width="50%" v-if="importFormVisible" :visible.sync="importFormVisible" @close="closeImport">
            <div v-if="importError == 0">
                <el-upload
                    class="upload-demo"
                    action="#"
                    ref="upload"
                    :limit="1"
                    :on-exceed="beforeUpload"
                    :file-list="uploadFileList"
                    :auto-upload="false">
                    <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
                    <el-button style="margin-left: 10px;" size="small" type="success" @click="importClasses">上传导入</el-button>
                </el-upload>
            </div>
            <el-form ref="upLoadClassesForm" :model="upLoadClassesForm" label-width="100px" v-if="importError == 1">
                <el-form-item label="错误信息：" style="color:red" prop="name">
                    <el-table :data="errorTable.slice((errorNowPage-1)*errorPageSize,errorNowPage*errorPageSize)" border style="width: 95%">
                        <el-table-column prop="orderNum" label="序号" width="50" align='center'></el-table-column>
                        <el-table-column prop="info" label="错误信息" align='center'></el-table-column>
                    </el-table>
                    <div style="float:left;margin-top:10px;">共&nbsp;{{errorTable.length}}&nbsp;条错误</div>
                    <el-pagination style="float:left;margin-top:5px;"
                            layout="prev, pager, next"
                            @current-change="error_current_change"
                            :total="errorTable.length"
                            :page-size="errorPageSize"
                            :current-page="errorNowPage"
                            background>
                    </el-pagination>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" >
                <el-button v-if="importError == 1" @click="closeImport()" type="primary">确  认</el-button>
                <el-button v-else @click="closeImport()" >取  消</el-button>
            </div>
        </el-dialog>

	</section>
</template>

<script>
	import util from '../../common/js/util'
	import { SysApi } from '@/api/index'
	import axios from 'axios';

	export default {
		data() {
			var isInteger = (rule, value, callback) => {
				if (!value) {
					return callback(new Error('输入不可以为空'));
				}
				setTimeout(() => {
					if (!Number(value)) {
						callback(new Error('请输入正整数'));
					} else {
						const re = /^[0-9]*[1-9][0-9]*$/;
						const rsCheck = re.test(value);
						if (!rsCheck) {
							callback(new Error('请输入正整数'));
						} else {
							callback();
						}
					}
				}, 1000);
			};
			return {
				filters: {
					schoolId: JSON.parse(sessionStorage.getItem("schoolId")),
					phaseId: '',
					gradeId: '',
					isGraduated: 0
					
				},
				tableData: [],
				phaseList: [],
				gradeList: [],
				subjectList: [],
				schoolName: '',
				classesId: '',
				classesName: '',
				teacherName: '',
				schoolId:  JSON.parse(sessionStorage.getItem("schoolId")),
				menuList: [],
				total: 0,
				duration: 1,
				listLoading: true,

				//班级信息表单
				classesForm: {
					classesId: '',
					classesName: '',
					classesNo: '',
					personalityName: '',
					schoolId:  JSON.parse(sessionStorage.getItem("schoolId")),
					phaseId: '',
					gradeId: '',
					enterYear: '',
					graduateYear: '',
					teacherId: '',
					teacherName: '',
					isGraduated: 0,
					useType: 0,
					duration: 1,
				},

				//班主任查询
				classesTeacherForm: {
					schoolId: JSON.parse(sessionStorage.getItem("schoolId")),
					phaseId: '',
					subjectId: '',
					userName: ''
				},

				classesTeacherData: [],
				teacherLoading: true,

				editType: '',

				editFormVisible: false, // 编辑界面是否显示
				editLoading: false,
				editGradeList: [],

				classTeacherVisible: false, // 班主任界面是否显示

				importFormVisible : false, // 导入界面是否显示

				uploadFileList: [],
				importError: 0,
				upLoadClassesForm:{}, 
				errorTable:[],
				errorPageSize:10,
				errorNowPage:1,

				classesRules: { //年级信息表单验证
					phaseId:[
						{ required: true,  message: '请选择学段', trigger: 'blur'},
						{ validator: isInteger, trigger: 'blur' }
					],
					gradeId:[
						{ required: true,  message: '请选择年级', trigger: 'blur'},
						{ validator: isInteger, trigger: 'blur' }
					],
					classesNo:[
						{ required: true,  message: '请填写班级编号', trigger: 'blur'},
						{ validator: isInteger, trigger: 'blur' }
					],
					enterYear:[
						{ required: true, message: '请填写入学年份', trigger: 'blur'},
						{ validator: isInteger, trigger: 'blur' }
					],
					graduateYear:[
						{ required: true, message: '请填写毕业年份' , trigger: 'blur'},
						{ validator: isInteger, trigger: 'blur' }
					]
            },
            pageSize:10,
            nowPage:1,

			gradeName: '',
			startyearList:[],
            endyearList:[],
            date : new Date().toLocaleDateString(),    //当前日期
            year : new Date().getFullYear(),           //当前年份
            update : new Date().getFullYear()+'/8/1' //本年8.1号

			}
		},
		created(){
			if(this.$route.params.schoolId != undefined){
				sessionStorage.setItem("schoolId", JSON.stringify(this.$route.params.schoolId));
				this.schoolId = this.$route.params.schoolId;
			}else{
				this.schoolId = JSON.parse(sessionStorage.getItem("schoolId"));
			}  
			
			this.getMenuList();
			this.getClassesList();
			this.getPhaseList();

		},
		mounted() {
			this.getClassesList();
		},
		watch:{
			classesForm:{
				handler: function (val, oldVal) { 
					//console.log(val)
					//生成班级名称
					if(val.gradeId && val.classesNo !==''){
						this.classesForm.classesName = this.gradeName + val.classesNo + '班'; 
					}
				},
				deep: true
			}
		},
		methods: {

			handleCurrentChange(val) {
				this.nowPage = val;
				this.getClassesList();
			},
			getMenuList(){
				this.menuList = sessionStorage.getItem('menuList');
			},
			//获取学段列表
			getPhaseList(){
				let params = {
					schoolId: this.schoolId
				};
				SysApi.getSchoolPhaseList(params, res => {
					if (res!=null)
					{
						this.phaseList = res;
					}
				}, (errorType, error) => {
				})
			},
			// 获得学科列表
			getSubjectList(phaseId){
				
				this.classesTeacherForm.subjectId = "";
				
				let params = {
						phaseId: phaseId
					};
	
					SysApi.getSubjectList(params, res => {
						if (res!=null)
						{
							this.subjectList = res;

							if (phaseId == null || phaseId == '' || phaseId <=0 )
							{
								this.subjectList = [];
							}
							else
							{
								this.subjectList = res;
							}
						}
					}, (errorType, error) => {

					})
			},
			//获取年级列表
			getGradeList(phaseId){
				this.filters.gradeId = '';
				let params = {
					phaseId: phaseId
				};
				SysApi.getGradeList(params, res => {
					if (res!=null)
					{
						this.gradeList = res;
					}
				}, (errorType, error) => {
				})
			},
			//获取年级列表
			getEditGradeList(phaseId){
				
				for(var i=0;i<this.phaseList.length;i++){
					if (phaseId == this.phaseList[i].phaseId)
					{
						this.classesForm.duration = this.phaseList[i].duration;
						this.duration = this.phaseList[i].duration;
						break;
					}
				 }

				this.classesForm.gradeId = '';
				this.classesForm.classesNo =  ''
				this.classesForm.classesName='',
				//this.classesForm.enterYear = '';
				this.classesForm.graduateYear = '';

				let params = {
					phaseId: phaseId
				};
				SysApi.getGradeList(params, res => {
					if (res!=null)
					{
						this.editGradeList = res;
					}
				}, (errorType, error) => {
				})
			},
			//获取班级列表
			getClassesList() {
				let params = {
					pageNum: this.nowPage,
					pageSize: this.pageSize,
					schoolId: this.schoolId,
					phaseId: this.filters.phaseId,
					gradeId: this.filters.gradeId,
					isGraduated: 0

				};
				this.listLoading = true;

				SysApi.getAllClassesListPage(params,res =>{
					this.total = res.total;
					this.tableData = res.list;
					this.listLoading = false;
				}, (errorType, error) => {
					this.listLoading = false;
				})


			},
			 //查询教师
			findSchoolTeacher(){

				this.teacherLoading = true;
				let params = {
					schoolId: this.classesTeacherForm.schoolId,
					phaseId: this.classesTeacherForm.phaseId,
					gradeId: this.classesTeacherForm.gradeId,
					subjectId: this.classesTeacherForm.subjectId,
					userName: this.classesTeacherForm.userName
				};
				SysApi.getSchoolTeacherListBySubjectId(params, res => {
					if (res!=null)
					{
						this.classesTeacherData = res;
						this.teacherLoading = false;
					}
				}, (errorType, error) => {
					this.teacherLoading = false;
				})
			},
			//删除
			handleDel: function (row) {
				this.$confirm('确认删除该记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
	
					let params = {
						 classesId: row.classesId,
						 schoolId: row.schoolId
						 };

					SysApi.deleteClasses(params,res =>{
						this.listLoading = false;
						if (res!=null)
						{
							this.$message({
								message: '删除成功',
								type: 'success'
							});
						}
						this.getClassesList();
					}, (errorType, error) => {
						this.listLoading = false;
					}).catch((error) => {
						this.listLoading = false;
					})
				}).catch(() => {

				});
			},
			//显示编辑界面
			handleEdit: function (row) {
				this.editType = "编辑";
				this.editLoading = true;
				//this.classesForm = Object.assign({}, row);
				this.classesForm.classesId = row.classesId;
				this.classesForm.phaseId =  row.phaseId;
				this.getEditGradeList(row.phaseId);
				this.classesForm.gradeId = row.gradeId;
				this.gradeName = row.gradeName;
				this.classesForm.classesNo =  row.classesNo;
				this.classesForm.classesName= row.classesName;
				this.classesForm.enterYear = row.enterYear;
				this.classesForm.graduateYear = row.graduateYear;
				this.classesForm.personalityName = row.personalityName;
				this.classesForm.schoolId = JSON.parse(sessionStorage.getItem("schoolId"));

				this.editFormVisible = true;
				this.editLoading = false;
				
				
			},
			//显示新增界面
			handleAdd: function () {
				this.editType = "新增";
				this.editLoading = true;

				this.classesForm.classesId = '';
				this.classesForm.phaseId =  '';
				this.classesForm.gradeId = '';
				this.classesForm.classesNo =  ''
				this.classesForm.classesName='',
				this.classesForm.enterYear = this.year;
				this.classesForm.graduateYear = '';
				this.classesForm.personalityName = '';
				this.editGradeList = [];

				this.editFormVisible = true;
				this.editLoading = false;
		
			},
			//显示教师界面
			handleTeacher: function (row) {
				this.teacherLoading = true;
				this.classesId = row.classesId;
				this.classesName = row.classesName;
				this.classesTeacherForm.phaseId = row.phaseId;
				if (row.teacherName!=null)
				{
					this.teacherName = row.teacherName ;
				}
				else
				{
					this.teacherName = "";
				}
				
				this.findSchoolTeacher();
				this.classTeacherVisible = true;
				this.teacherLoading = false;
				
			},
			//编辑
			editSubmit: function () {
				this.$refs.classesForm.validate((valid) => {
					if (valid) {
							
							let params = Object.assign({}, this.classesForm);
							
							SysApi.saveClasses(params,res =>{
								this.listLoading = false;
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['classesForm'].resetFields();
								this.editFormVisible = false;
								this.getClassesList();
							}, (errorType, error) => {
								this.$message({type: 'error', message: '提交失败!'})
								// console.log("error=");
								// console.log(error);
	
							})
							
					}
				});
			},
			closeDialog: function () {
				
				this.$refs['classesForm'].resetFields();
				this.editFormVisible = false;
			},
			
			//年级联动
			changeGrade(id){
				
				let index
				for(let i = 0;i<this.editGradeList.length;i++){
					if(this.editGradeList[i].gradeId == id){
						this.gradeName = this.editGradeList[i].gradeName;
						index = this.editGradeList[i].yearNum
					}
				};
				
				if(this.date<this.update){

					//入学年份list换算
					var startyear = (this.year - this.duration)-1
					let arr = [];
					for(let i = 1;i<(this.year-startyear);i++){
						arr.push(this.year-i);
						this.startyearList = arr;      
					};
					//毕业年份list换算
					var endyear = (this.year + this.duration)-1;
					let arr_1 = [];
					for(let i = this.year;i<=endyear;i++){
						arr_1.push(i);
						this.endyearList = arr_1;      
					};
					this.classesForm.enterYear = this.startyearList[index-1];
					this.classesForm.graduateYear = Number(this.classesForm.enterYear) + this.duration;
				}else{
					//入学年份list换算
					var startyear =  (this.year - this.duration)

					let arr = [];
					for(let i = 1;i<(this.year + 1-startyear);i++){
						arr.push(this.year + 1 - i)
						this.startyearList = arr
					};
					//毕业年份list换算
					var endyear = (this.year + this.duration);
					let arr_1 = [];
					for(let i = this.year+1;i<=endyear;i++){
						arr_1.push(i);
						this.endyearList = arr_1;      
					};

					this.classesForm.enterYear = this.startyearList[index-1];
					this.classesForm.graduateYear = Number(this.classesForm.enterYear) + this.duration;
				}
			},
			//换算年级和毕业年份
			changestartYear(){
							
				if(this.date<this.update){

					if ((this.year - this.classesForm.enterYear - 1)<0 || (this.year - this.classesForm.enterYear - 1)>=this.duration )
					{
						this.$message({
							message: '入学年份不在有效范围内',
							type: 'error'
						});
						this.classesForm.graduateYear = '';
						this.classesForm.gradeId = ''; 
						this.classesForm.classesName = '';
						return;
					}

					this.classesForm.gradeId = this.editGradeList[this.year - this.classesForm.enterYear - 1].gradeId;
					this.classesForm.graduateYear = Number(this.classesForm.enterYear) + this.duration;
					this.changeGrade(this.classesForm.gradeId);
				}else{
					
					if ((this.year - this.classesForm.enterYear)<0 || (this.year - this.classesForm.enterYear)>=this.duration )
					{
						this.$message({
							message: '入学年份不在有效范围内',
							type: 'error'
						});
						this.classesForm.graduateYear = '';
						this.classesForm.gradeId = ''; 
						this.classesForm.classesName = '';
						return;
					}
					this.classesForm.gradeId = this.editGradeList[this.year - this.classesForm.enterYear ].gradeId;
					this.classesForm.graduateYear = Number(this.classesForm.enterYear) + this.duration
					this.changeGrade(this.classesForm.gradeId);
				}           
			},
			//换算年级和入学年份
			changeendYear(){
				if(this.date<this.update){
					
					if ((this.year - this.classesForm.graduateYear + this.duration)<0 || (this.year - this.classesForm.graduateYear + this.duration)>=this.duration )
					{
						this.$message({
							message: '毕业年份不在有效范围内',
							type: 'error'
						});
						this.classesForm.enterYear = '';
						this.classesForm.gradeId = ''; 
						this.classesForm.classesName = '';
						return;
					}
					this.classesForm.enterYear = Number(this.classesForm.graduateYear-1) - this.duration;
					this.classesForm.gradeId = this.editGradeList[ this.year - this.classesForm.graduateYear + this.duration ].gradeId; 
					this.changeGrade(this.classesForm.gradeId);
				}else{
					
					if ((this.year - this.classesForm.graduateYear + this.duration)<0 || (this.year - this.classesForm.graduateYear + this.duration)>=this.duration )
					{
						this.$message({
							message: '毕业年份不在有效范围内',
							type: 'error'
						});
						this.classesForm.enterYear = '';
						this.classesForm.gradeId = ''; 
						this.classesForm.classesName = '';
						return;
					}
					this.classesForm.enterYear = Number(this.classesForm.graduateYear) - this.duration;
					this.classesForm.gradeId = this.editGradeList[this.year - this.classesForm.graduateYear + this.duration].gradeId;
					this.changeGrade(this.classesForm.gradeId);
				}  
			},
			TeacherChange(row){
            if(row){
                this.teacherName = row.userName ;
                let params = {
						 classesId: this.classesId,
						 teacherId: row.userId
						 };

					SysApi.saveClassesTeacher(params,res =>{
						this.$message({
							message: '更新班主任成功',
							type: 'success'
						});
						this.getClassesList();
					}, (errorType, error) => {
			
					})
			
			}
			
		},
		handleSubjectTeacher(row){
				this.$router.push({
					name:'任课教师管理',
					params:{
						phaseId: row.phaseId,
						classesId: row.classesId,
						classesName: row.classesName
					}
				});
		},
		//显示导入界面
		handleImport() {
			this.importFormVisible = true;
			
		},
		//导入班级
        importClasses(){
            if(this.$refs['upload'].uploadFiles.length > 0){
                const formData = new FormData();
                const file = this.$refs.upload.uploadFiles[0];
               // const headerConfig = { headers: { 'Content-Type': 'multipart/form-data' } };
                formData.append('file', file.raw);
				formData.append("schoolId", this.schoolId);

                SysApi.importClasses(formData, res => {
					if (res.statusinfo === 'error') {
							
							this.errorTable = res.errordata || [];
							this.errorNowPage = 1;
							this.nowPage = 1;
							this.importError = 1;
							this.getClassesList();
					}else{
						this.getClassesList();
						this.closeImport();
						this.importError = 0;
						this.nowPage = 1;
						this.$message({type: 'success', message: '导入成功!'})
					}
				});
                    
            }else{
                this.$message({
                    message: '请选择要上传的文件',
                    type: 'warning'
                });
            }
        },
        //导入班级窗口关闭
        closeImport(){
            this.importFormVisible = false;
            this.uploadFileList = [];
            this.importError = 0;
        },
        beforeUpload(files, uploadFileList) {
            this.$message.warning(`只能选择 1 个文件，目前共选择了 ${files.length + uploadFileList.length} 个文件`);
		},
		error_current_change(errorNowPage){
			this.errorNowPage = errorNowPage;
		},
		//判断菜单是否可见
		checkMenu(item){

			if (this.menuList==null || this.menuList.length==0)
			{
				return -1;
			}
			var index = this.menuList.indexOf(item);
			return index
		}

	},
		
}

</script>

<style>
.el-table >.el-table__fixed {
    height: 100% !important; 
  }
.el-table >.el-table__fixed-right {
    height: 100% !important; 
  }
.el-table--scrollable-x .el-table__body-wrapper {
    z-index: 1;
  }
</style>